package br.edu.ifpb.restaurante.conexao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import br.edu.ifpb.restaurante.gui.Aviso;

public class ConnectionFactory {
	
	public Connection getConnection() {
		try {
			return DriverManager.getConnection("jdbc:mysql://localhost:3306/restaurante", "user", "user123");
		} catch (SQLException e){
			try {
				return DriverManager.getConnection("jdbc:mysql://poocare.ddns.net:3306/restaurante", "user", "user123");
			} catch (SQLException ex){
				new Aviso(1,"Nao foi posivel conectar com o Banco de Dados, tente novamente mais tarde");
			}
		}	
		
		return null;
	}
	
}
